package com.me.service;

import com.me.mapper.UserMapper;
import com.me.pojo.User;
import com.me.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class UserService {

    SqlSessionFactory factory = SqlSessionFactoryUtils.getSqlSessionFactory();
    public String selectByUsername(String username){
        //2. 获取SqlSession
        SqlSession sqlSession = factory.openSession();
        //3. 获取BrandMapper
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);

        //4. 调用方法
        String user = mapper.selectByUsername(username);

        sqlSession.close();

        return user;


    }
}
